package cn.wolfcode;

import cn.wolfcode.web.interceptor.LoginOut;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication(scanBasePackages = "cn.wolfcode")
@MapperScan("cn.wolfcode.mapper")
public class App implements WebMvcConfigurer {
   @Autowired
    private LoginOut loginOut;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册登录拦截器
        registry.addInterceptor(loginOut)
                //对哪些资源起过滤作用
                .addPathPatterns("/**")
                // 对哪些资源起排除作用
                .excludePathPatterns("/loginUser","/login.html","/css/**","/js/**","/empLogin");
   }
    public static void main(String[] args) {
        SpringApplication.run(App.class,args);
    }
}
